
import request from '@/utils/request';
import { AxiosPromise } from 'axios';

// 知识库-应用：分页查询应用
export const aiqaApiWikiAppsList = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/aiqa/wiki/apps/list',
    method: 'get',
    params: query
  });
};

// 查询知识库列表
export const aiqaDifyDatasets = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/aiqa/dify/datasets',
    method: 'get',
    params: query
  });
};

//知识库-应用：创建应用
export const aiqaApiWikiAppsCreate = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/aiqa/wiki/apps/create',
    method: 'post',
    data: query
  });
};

//知识库-应用：修改应用
export const aiqaApiWikiAppsUpdate = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: '/aiqa/wiki/apps/update',
    method: 'put',
    data: query
  });
};

//知识库-应用：删除应用
export const aiqaApiWikiAppsDelete = (query?: any): AxiosPromise<any[]> => {
  return request({
    url: `/aiqa/wiki/apps/delete`,
    method: 'delete',
    data:query
  });
};

// 查询用户(无权限)
export const apiuUserQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
      url: `/system/user/queryFreePerm`,
      method: "get",
      params: query
  });
}

// 查询部门（无权限）
export const apiuDeptQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
      url: `/system/dept/queryFreePerm`,
      method: "get",
      params: query
  });
}

// 查询角色（无权限）
export const apiRoleQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
      url: `/system/role/allUnlimited`,
      method: "get",
      params: query
  });
}

// 查询岗位（无权限）
export const apiJobQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
  return request({
      url: `/system/post/queryUnlimited`,
      method: "get",
      params: query
  });
}

// 新增角色
export const apiEnterprisePermInertRoler = (data?: any): AxiosPromise<any[]> => {
  return request({
      url: `/knowledge/enterprisePerm/inertRoler`,
      method: "post",
      data: data
  });
}
//查询文件用户下角色绑定-知识库-应用：获取应用权限信息
export const apiEnterprisePermSelectRoler = (appId?: any): AxiosPromise<any[]> => {
  return request({
      url: `/aiqa/wiki/apps/${appId}/permissions`,
      method: "get",
  });
}

// 知识库-应用：分配应用权限
export const aiqaWikiAppsAppIdAssignPermissions = (appId?: any,data?:any): AxiosPromise<any[]> => {
  return request({
      url: `/aiqa/wiki/apps/${appId}/assignPermissions`,
      method: "post",
      data: data
  });
}
